<template>
  <div class="Sidebar">
    <div class="Sidebar__content">
      <div
        class="Sidebar__content__list"
        v-for="(item, index) in navPlayData"
        :key="index"
        @click="isShowSeach(navPlayData[index])"
      >
        <i>
          <svg class="icon icon-i" aria-hidden="true">
            <use :xlink:href="item.svgIcon"></use>
          </svg>
        </i>
        <div class="Sidebar__content__list-text">{{ item.title }}</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "NavPlay",
  data() {
    return {
      bool: false,
      navPlayData: [],
      // navPlayData: [
      //   { svgIcon: "#icon-wode", text: "我的" },
      //   { svgIcon: "#icon-sousuo", text: "搜索" },
      //   { svgIcon: "#icon-bangdan", text: "榜单" },
      //   { svgIcon: "#icon-tuijian", text: "推荐" },
      //   { svgIcon: "#icon-gedan", text: "歌单" },
      //   { svgIcon: "#icon-xiazai", text: "下载" },
      //   { svgIcon: "#icon-shezhi", text: "设置" },
      // ],
    };
  },
  created() {
    this.navPlayData = this.$store.state.Routes.routesMenu;
  },
  methods: {
    // navList(){
    //   let list = this.$router.options.routes[0].children;
    //   list.forEach(V => {
    //     console.log(V);
    //   });
    // },
    isShowSeach(item) {
      this.$router.push({ name: item.name });
    },
  },
};
</script>

<style lang="scss" scoped>
.Sidebar {
  height: 100%;
  width: 125px;
  min-width: 125px;
  z-index: 1000;
  display: flex;
  align-items: center;
  &__content {
    width: 100%;
    // height: 100%;
    box-sizing: border-box;
    &__list {
      // background-color: #057032;
      position: relative;
      height: 50px;
      margin-top: 40px;
      padding: 5px 0;
      text-align: left;
      // background-color: red;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      i {
        flex: 1;
        display: block;
        width: 48px;

        height: 48px;
        // margin: 0 20px 0 15px;
        .icon-i {
          width: 100%;
          height: 100%;
          color: #fff;
        }
      }
      &-text {
        position: absolute;
        right: -80px;
        font-size: 30px;
        color: #fff;
        align-items: center;
        text-align: center;
        display: none;
      }
      &:hover {
        .Sidebar__content__list-text {
          display: block;
        }
      }
    }
  }
}
</style>
